package edu.purdue.touch.demo;

import TUIO.TuioCursor;
import edu.purdue.touch.piccolo.event.PBasicTouchEventListener;
import edu.purdue.touch.piccolo.event.PTouchEventManager;
import edu.umd.cs.piccolo.PNode;
import edu.umd.cs.piccolo.nodes.PPath;
import edu.umd.cs.piccolo.nodes.PText;
import edu.umd.cs.piccolox.PFrame;

public class Demo {
	private static PNode p[];
	public static void main(String[] args) {
		PFrame frame = new PFrame();
		p = new PNode[2];
    	for (int i=0; i<2; i++){
    		
	    	p[i] = PPath.createRectangle(50+i*600, 50, 500, 500);
	    	
	    	final PNode node = p[i];
	    	
	    	PTouchEventManager.getInstance().addTouchEventListener(node, new PBasicTouchEventListener() {
	    		public void hovered(TuioCursor tcur) {
	    			node.removeAllChildren();
	    			node.addChild(new PText("Hovering"));
	    			System.out.println("hovering...");
	    		}
	    		
	    		public void tapped(TuioCursor tcur) {
	    			System.out.println("tapped...");
	    		}
	    		public void selected(TuioCursor tcur1, TuioCursor tcur2) {
	    			System.out.println("selected...");
	    		}
	    	});
	    	frame.getCanvas().getLayer().addChild(p[i]);
    	}
	}
}
